package com.ktjy.t382.ch03.controller;

import com.ktjy.t382.ch03.entity.SysUser;
import jakarta.servlet.http.HttpSession;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
public class LoginController {

    @GetMapping("/login")
    public String login() {
        return "login";
    }

    @RequestMapping("/dologin")
    public String dologin(SysUser sysUser, HttpSession session) {
        sysUser.setRealName("张三");
        session.setAttribute("loginUser", sysUser);
        return "main";
    }
}
